home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98a.txt
/
000151_icon-group-sender _Mon Mar 30 12:26:09 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
5KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id MAA12051
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 30 Mar 1998 12:26:09 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA31944; Mon, 30 Mar 1998 12:26:08 -0700
X-Sender: clodius@nis-pop.lanl.gov
Message-Id: <v04003a05b1456cacc392@[128.165.58.113]>
In-Reply-To: <199803281452.HAA29037@orpheus.gemini.edu>
References: "William B. Clodius"'s mail message of Mar 27, 1:49pm.
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="============_-1320848357==_============"
Date: Mon, 30 Mar 1998 10:08:52 -0600
To: icon-group@optima.CS.Arizona.EDU
From: "William B. Clodius" <wclodius@lanl.gov>
Subject: Re: Icon and recursion
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 3938
--============_-1320848357==_============
Content-Type: text/plain; charset="us-ascii"
After modifying some things around I now have a version of the Change
benchmark that is working. I am not certain which modification caused it to
work, but I suspect it involved the local attribute for some temporaries.
After I got it working I rewrote the benchmark to eliminate most
temporaries, and got about a 30% improvement in performance. As might be
expected with an interpreter for a problem code that does not address the
language domain, performance is about two orders of magnitude slower than
for compiled imperative languages. On the other hange the source code is
from 3/4 to half the size of that of the imperative languages, C and F90.
I should note that at this point I am mostly interested in learning the
flavor of the language before I decide to learn it in detail, so I have not
gotten Griswold's text. I have read the introductory material by Hanson,
Shipman, and Griswold that is available on the net. The system I am using
is an SGI Indigo 2 although I also have an old Power Mac available.
There was some interest expressed in seeing the code I was using so that I
have attached them. The Tak benchmark (and the change benchmark for large
argument values) results in an Evaluation stack exceeded error which I
suspect is due to the large number of recursions invoked by the benchmarks,
and not to any problems in Icon with recursion in general. Tak in
particular was designed to test the effiency of general recursion and
invokes recursion I believe tens of thousands of times.
--============_-1320848357==_============
Content-Id: <v04003a05b1456cacc392@[128.165.58.113].0.0>
Content-Type: text/plain; name="change.icn"; charset="us-ascii"
Content-Disposition: attachment; filename="change.icn"
; modification-date="Mon, 30 Mar 1998 09:41:55 -0600"
procedure main( args )
local start_time, n
start_time := &time;
n := integer(args[1]);
write ( args[1], " ", count_change(n), " ",
(&time-start_time)/1000., " s");
end
procedure first_denomination( kinds_of_coins )
case kinds_of_coins of {
1: return 1
2: return 5
3: return 10
4: return 25
5: return 50 };
end
procedure cc( amount, kinds_of_coins )
if amount = 0 then {return 1} else {
if amount < 0 then {return 0} else {
return cc( (amount - first_denomination( kinds_of_coins )),
kinds_of_coins ) + cc(amount, kinds_of_coins - 1) } }
end
procedure cc_tail( amount, kinds_of_coins, count )
if amount = 0 then {return count + 1} else {
if (amount < 0 | kinds_of_coins = 0) then {return count} else {
return cc_tail( (amount - first_denomination(kinds_of_coins)),
kinds_of_coins, cc_tail( amount, kinds_of_coins-1, count)) }}
end
procedure count_change( amount )
return cc_tail( amount, 5, 0 );
end
--============_-1320848357==_============
Content-Id: <v04003a05b1456cacc392@[128.165.58.113].0.1>
Content-Type: application/mac-binhex40; name="tak.icn"
Content-Disposition: attachment; filename="tak.icn"
; modification-date="Mon, 30 Mar 1998 09:42:21 -0600"
(This file must be converted with BinHex 4.0)
:"h4KDbjTBfi!9%9B9(4dH(3"!!!!!3B!!!!!irG`FQpMC@4eFQ8JE@&TELJJ+3d
M)#!JCACPFRNJ)'iJ1MdJ-5"dEb!a-#!JC'm0)#!J)#!J)(GbDA4P)#JQG'PYC5`
JG'&V+#!a1#`J-6)X)$BT+6X0C@jN$A"bEf0PC(9bC5"dB@XSH#`JH5`JHLN0)#!
J)'PQ)'j[G#"j)$`JH#"dD'9Z$3PbCA0eE(3J1MdJHJdJ)#!JC@acC3d*FQ9cG@a
d)$Sp)(4KDbJJG'&V+#!a,AJX)(NX)(ST,#!0#3NJ)#!J)#!JG'&V+#!a,ANX)(S
X)(JT,!d*#5!J)#!J)#"dB@XS)$%YHL`JH#`JH5NT1`ebCA4eFQiJFQ9cG@ad1`e
PEQ30rKB!!!:
--============_-1320848357==_============
Content-Type: text/plain; charset="us-ascii"
William B. Clodius Phone: (505) 665-9370
Los Alamos Natl. Lab., NIS-2 FAX: (505) 667-3815
PO Box 1663, MS-C323 Group Off.: 505/667-3422 or 667-5127
Los Alamos, NM 87545 email: wclodius@lanl.gov
--============_-1320848357==_============--